package com.boyaa.shells.tool 
{
	import flash.display.MovieClip;
	import flash.events.KeyboardEvent;
	/**
	 * 加入ESC /ENTER
	 * @author fly
	 */
	public class TooltipEvent extends TooltipBase
	{
		
		public function TooltipEvent(mc:MovieClip) 
		{
			super(mc);
		}
		
		
		/**
		 *  加事件
		 */
		override protected function addEvent():void
		{
			super.addEvent();
			_displayObject.stage.addEventListener(KeyboardEvent.KEY_UP, useBykey);
		}
		
		
		/**
		 *  删事件
		 */
		override protected function remove():void
		{
			if(_displayObject.stage)
				_displayObject.stage.removeEventListener(KeyboardEvent.KEY_UP, useBykey);
			super.remove();
			
		}
		
		
		private function useBykey(e:KeyboardEvent):void 
		{
			var keyCode:int = e.keyCode;
			if (keyCode == 13)
				onOK(null);
			else if (keyCode == 27)
				remove();
		}
	}

}